#!/usr/bin/env perl

use strict;
BEGIN {
	if(!exists($::ENV{LINUXHA_LIBS})) {
		$::ENV{LINUXHA_LIBS}="/opt/linuxha14/lib/perl";
	}
	push @INC,$::ENV{LINUXHA_LIBS};
}

use Data::Dumper;
use clnet qw(:ALL);
use clutils;

# We need to pull in some clutils to parse the XML ....

my ($xml,$rc,@msg)=validate_cluster_cfg("clconf-tests.xml","unsecure");

if(!defined($xml)) {
	print STDERR "$_\n" foreach(@msg);
	exit(1);
}

# Perform a basic test on the _CLNET_get_card_list2 command

{
	my @z=_CLNET_get_card_list2(xml=>$xml,node=>"bongo",network=>"aaa");
	print "_CLNET_get_card_list2(node=bongo,network=aaa,...) : ",Dumper(\@z);
	@z=_CLNET_get_card_list2(xml=>$xml,node=>"bongo",network=>"a");
	print "_CLNET_get_card_list2(node=bongo,network=a,...) : ",Dumper(\@z);
	print "Results for node=bongo,network=a : ",Dumper(\@z);
}

# Perform some tests on the CLNET_check_one_ip2 routine

{
	my @r=CLNET_check_one_ip2(node=>"bongo",network=>"a",xml=>$xml);
	print "CLNET_check_one_ip2(node=bongo,network=a,...) : ",Dumper(\@r);
}

# Perform a couple of CLNET_check_cards_exists2 tests

{
	my @r=CLNET_check_cards_exist2(node=>"bongo",network=>"aaa",xml=>$xml);
	print "CLNET_check_cards_exist2(node=bongo,network=aaa,...) : ",Dumper(\@r);
	@r=CLNET_check_cards_exist2(node=>"bongo",network=>"a",xml=>$xml);
	print "CLNET_check_cards_exist2(node=bongo,network=a,...) : ",Dumper(\@r);
}

# Perform some CLNET_get_network_attributes2 tests

{
	my @r=CLNET_get_network_attributes2(node=>"bongo",network=>"a",xml=>$xml);
	print "CLNET_get_network_attributes2(node=bongo,network=a,...) : ",Dumper(\@r);
	my @r=CLNET_get_network_attributes2(node=>"bongo",network=>"b",xml=>$xml);
	print "CLNET_get_network_attributes2(node=bongo,network=b,...) : ",Dumper(\@r);
}
